#! /usr/local/bin/python2.5

from psychopy import core, visual
import scipy
import parallel
from stimuli.helper_codes.pport_functions import wait_for_pulse
from psychopy import gui
import time


trialClock = core.Clock() # start the clock
getTime = trialClock.getTime # just to ease readability...

p = parallel.Parallel() # get access to the parallel port
print "Waiting for pulse."
i = 0
while True:
    t = getTime()
    wait_for_pulse(p) # poll the parallel port for a pulse every pport_dt seconds
    i +=1
    print "Recieved pulse %d after waiting for %3.3f ms." % (i, (getTime()-t)*1000)
